Add find_token MCP tool support#3
Merged
RaghavSood merged 5 commits intofeature/mcp-vault-infofrom Feb 24, 2026
Merged
Conversation
7 tasks
d4afa11 to
edb69f7
Compare
Extract token search results from the find_token MCP tool and pass them as structured data in the API response so frontend apps can prompt users to add tokens/chains to their vault. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two issues prevented the tokens field from appearing in API responses: 1. CallTool discarded text on IsError — when the MCP tool set IsError: true, CallTool returned a Go error and the text content was lost. Now returns a ToolError that carries the text, so executeTool can still pass it to trackToolResult for structured extraction. 2. trackToolResult assumed pure JSON — MCP tools may return multiple text content blocks (joined with \n) or mix descriptive text with JSON. The direct json.Unmarshal failed silently. Now uses extractTokens() which tries direct unmarshal first, then scans for JSON objects in the text using json.Decoder (which handles trailing content). Also adds diagnostic logging when parsing fails so we can see the actual MCP result text in logs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3de125d to
5078c33
Compare
Integrate MCP resources protocol (resources/list, resources/read) to
discover and load skill guides from the MCP server. Skills are markdown
documents at skills/{slug}.md that provide detailed workflow instructions.
The skill list is injected into the system prompt so the LLM knows what's
available, but skill content is only loaded on-demand via the new get_skill
tool when relevant to the user's request. This keeps the context window
lean as the skill library grows.
- MCP client: add ListSkills, ReadSkill, SkillSummary with TTL caching
- Agent: extend MCPToolProvider interface with skill methods
- Agent: inject skill summary into system prompt after tool descriptions
- Tools: add get_skill native tool (only registered when skills exist)
- Executor: add get_skill handler delegating to MCP ReadSkill
- Main: pre-warm skill cache at startup alongside tools
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The MCP server returns skill resources with URIs like "skill://vultisig/evm-contract-call.md" but extractSkillSlug was filtering for the "skills/" prefix, discarding all entries. - extractSkillSlug now extracts the last path segment before .md, handling any URI scheme (skill://, skills/, etc.) - ReadSkill now looks up the full URI from the skill cache instead of constructing it, so it works with any URI format Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add MCP skill discovery and on-demand loading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
find_tokenMCP tool so frontend apps receive token/chain data they can act onTokenSearchResult,Token, andTokenDeploymenttypes mirroring the MCP tool responsetokensfield toSendMessageResponse(omitted when nil)find_tokenresults intrackToolResultalongside existing transaction/suggestion extractionStacked on #2.
Frontend Integration
When the AI calls
find_token, the API response will include a newtokensfield with the full token data (name, symbol, logo, market cap rank, and per-chain deployments with contract addresses and decimals). Frontend apps should use this to present an "Add Token" flow, letting the user select which chain deployments to add to their vault.See the PR description below for the full response schema and integration guide.
tokensfield schemaExample full response
{ "message": { "role": "assistant", "content": "I found USDC. It's available on several chains..." }, "tokens": { "tokens": [ { "id": "usd-coin", "name": "USD Coin", "symbol": "USDC", "market_cap_rank": 7, "logo": "https://assets.coingecko.com/coins/images/6319/large/usdc.png", "deployments": [ { "chain": "Ethereum", "contract_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "decimals": 6 }, { "chain": "Arbitrum", "contract_address": "0xaf88d065e77c8cc2239327c5edb3a432268e5831", "decimals": 6 }, { "chain": "Polygon", "contract_address": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", "decimals": 6 } ] } ] } }Test plan
tokensfield is omitted from response JSON whenfind_tokenis not calledtokensfield is populated whenfind_tokenreturns resultstokensfield is omitted whenfind_tokenreturns an errorgo build ./...🤖 Generated with Claude Code